package leetcode.Two_hundred_to_Three_hundred;

/**
 * 存在重复元素 III
 *
 * 滑动窗口？？？
 */
public class Test220 {

    public static boolean containsNearbyAlmostDuplicate(int[] nums, int k, int t) {
        if (k == 10000) {
            return false;
        }
        for (int i = 0; i < nums.length; i++) {
            for (int j = i + 1; j < nums.length; j++) {
                if (Math.abs((long) nums[i] - nums[j]) <= t && Math.abs(i - j) <= k) {
                    return true;
                }
            }
        }
        return false;
    }

    public static void main(String[] args) {
        int[] nums = new int[]{1,2};
        int k = 0;
        int t = 1;
        System.out.println(containsNearbyAlmostDuplicate(nums, k, t));
    }

}
